/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package dropbinconnect;

import dropbinconnect.helper.Connect;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author LegACy
 */
public class Main {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
		try {
			boolean Login = Connect.login("raka", "raka");
			System.out.println("Login success!");
		} catch (Exception ex) {
			System.out.println(ex.getMessage());
		}
		
		//Transferring file via string
		try {
			//Open original file
			File NewFile = new File("icon.png");
			FileInputStream In = new FileInputStream(NewFile);

			//Read each byte to string
			String Fil = "";
			int C = In.read();
			while (C > -1) {
				Fil += (char)C;
				C = In.read();
			}

			//Close stream
			In.close();

			//Create the new file
			File Created = new File("icon2.png");
			FileOutputStream Out = new FileOutputStream(Created);

			//Write each byte from file to string
			for (int i = 0; i < Fil.length(); i++)
				Out.write((int)Fil.charAt(i));
			Out.flush();
			Out.close();
		} catch (IOException ex) {
			System.out.println(ex.getCause());
		}
    }

}
